#include <stdio.h>
#include <stdlib.h>

double power(double x, int n)
{
	double c = 1.0, b = x;
	while (n)
	{
		if (n&1) 	
		{
			c=c*b;
		}
	b=b*b;
	n>>=1;
	}
	

	return c;
}

int main()
{
	int n=0, check;
	double x=0;

	printf("Vvedite osnovanie:");
	check=scanf("%lf", &x);
	if (check!=1)
	{
		printf("Incorrect base.\n");
		return -1;
	}
	
	printf("Vvedite stepen:");
	check=scanf("%d", &n);
	if (check!=1)
	{
		printf("Incorrect power. \n");
		return -1;
	}

	printf("Otvet: %g\n", power(x, n));
	system("PAUSE");
}